﻿<DemoPageSectionComponent Id="Editors-ListBox-Overview" ShowSizeMode="true">
    <ChildContentWithParameters Context="Params">
        @inject NwindDataService NwindDataService

        <DxListBox Data="@Data"
                   TextFieldName="@nameof(Employee.Text)"
                   @bind-Value="@Value"
                   SizeMode="Params.SizeMode"
                   CssClass="cw-400 chi-220">
        </DxListBox>
        <p class="demo-text cw-400 mt-2">
            Selected item: <b>@Value?.Text</b>
        </p>
    </ChildContentWithParameters>

    @code {
        IEnumerable<Employee> Data { get; set; }
        Employee Value { get; set; }

        protected override async Task OnInitializedAsync() {
            Data = await NwindDataService.GetEmployeesAsync();
            Value = Data.FirstOrDefault();
        }
    }
</DemoPageSectionComponent>
